# Replication Package: Demographics and Sovereign Risk: Do Markets Price Population Aging?

**Paper 21 in the Demographics & Global Capital Allocation series**
**Brian Peters, March 2026**

---

## Overview

This paper tests whether sovereign credit markets price population aging. Key findings: aging amplifies sovereign debt sensitivities in bond markets (Z₁ = +14.5**, pooled; +11.4**, two-way FE), but the eurozone crisis temporarily reversed the relationship by confounding "old" with "fiscally distressed." Youth dependency reduces ratings (-8.26***). 79/79 leave-one-out iterations significant.

## Software Requirements

- Python 3.10+
- Required packages: `numpy`, `pandas`, `statsmodels`, `scipy`, `matplotlib`, `python-docx`
- Install: `pip install numpy pandas statsmodels scipy matplotlib python-docx`

## Directory Structure

```
replication/
  REPLICATION_README.md
  scripts/
    phase1_data_assembly.py      # Data assembly (merges ratings, spreads, demographics)
    phase2_baseline.py           # Baseline regressions (ratings + spreads)
    phase3_mechanisms.py         # Interaction effects, mediation, structural breaks
    phase4_structural_break_deep.py  # Deep structural break analysis
    phase5_referee_fixes.py      # Referee-requested robustness
    build_docx.py                # DOCX generation
  src/
    model.py                     # PanelGLS estimator (shared across series)
    [other shared modules]
  data/processed/
    spread_panel.csv             # Processed panel (ratings, spreads, demographics)
  output/tables/
    [17 markdown tables]         # All regression output
  paper/
    paper.md                     # Manuscript source
```

## Reproduction

Run scripts in order:
```bash
python3 scripts/phase1_data_assembly.py
python3 scripts/phase2_baseline.py
python3 scripts/phase3_mechanisms.py
python3 scripts/phase4_structural_break_deep.py
python3 scripts/phase5_referee_fixes.py
```

**Note:** Scripts use absolute paths (`/mnt/c/demographics_capital_flows/...`). Update the path references at the top of each script for your local environment.

## Data Sources

- UN World Population Prospects (2024 Revision) — age distributions
- S&P sovereign ratings — long-term foreign currency
- IMF WEO — fiscal balance, GDP, current account
- Penn World Table 10.01 — output per worker
- Chinn-Ito KAOPEN — capital account openness
- Lane-Milesi-Ferretti — net foreign assets
